import {Component, OnInit} from '@angular/core';
import {NgForm} from '@angular/forms';
import {AuthService} from '../auth.service';
import {ReCaptchaV3Service} from 'ng-recaptcha';

@Component({
  selector: 'app-signup',
  templateUrl: './signup.component.html',
  styleUrls: ['./signup.component.scss']
})
export class SignupComponent implements OnInit {
  public isLoading = false;
  public verifyLevel = true;
  public buttonTitle = 'درخواست کدفعال‌سازی';

  constructor(
    private authService: AuthService,
    private reCaptchaV3Service: ReCaptchaV3Service
  ) {
  }

  ngOnInit() {
  }

  submitForm(form: NgForm) {
    this.reCaptchaV3Service.execute('login')
      .subscribe(captchaResponse =>  this.authService.signUp(form.value));
  }
}
